import request from '@/utils/request'

// 查询商品类目列表
export function listProductinfo(query) {
  return request({
    url: '/store/productinfo/list',
    method: 'get',
    params: query
  })
}

// 查询商品类目详细
export function getProductinfo(productCode) {
  return request({
    url: '/store/productinfo/' + productCode,
    method: 'get'
  })
}

// 新增商品类目
export function addProductinfo(data) {
  return request({
    url: '/store/productinfo',
    method: 'post',
    data: data
  })
}

// 修改商品类目
export function updateProductinfo(data) {
  return request({
    url: '/store/productinfo',
    method: 'put',
    data: data
  })
}

// 删除商品类目
export function delProductinfo(productCode) {
  return request({
    url: '/store/productinfo/' + productCode,
    method: 'delete'
  })
}

export function onlinestoreAllList() {
  return request({
    url: '/store/onlinestore/all/list',
    method: 'get'
  })
}


export function getinventorylist(productCode) {
  return request({
    url: '/store/inventory/productCode/' + productCode,
    method: 'get'
  })
}
// 0929


// export function listProductinfo(query) {
//   return request({
//     url: '/store/productinfo/list',
//     method: 'get',
//     params: query
//   })
// }

export function getProductinfoNew(query) {
  return request({
    url: '/store/productinfo/release/list',
    method: 'get',
    params: query
  })
}


// export function getProductinfoNew(res) {
//   return request({
//     url: '/store/productinfo/release/list?storeName=' + res.storeName + '&productCode=' + res.productCode + '&productFlag=' + res.productFlag +
//       '&productName=' + res.productName,
//     method: 'get'
//   })
// }
// 编辑
export function productCodeEditDetails(data) {
  return request({
    url: '/store/productinfo/release/edit',
    method: 'post',
    data: data
  })
}

// 回显
export function productinfoDisplay(productCode) {
  return request({
    url: '/store/productinfo/release/' + productCode,
    method: 'get'
  })
}

// 发布商品
export function productinfoRelease(data) {
  return request({
    url: '/store/productinfo/release',
    method: 'post',
    data: data
  })
}
// 获取地址行政详细信息
export function getAddressInfo(query) {
  return request({
    url: '/user/places/APP/V1/getAddressInfo',
    method: 'get',
    params: query
  })
}
// 商品管理，审核
export function productinfoAudit(data) {
  return request({
    url: '/store/productinfo/release/audit',
    method: 'post',
    data: data
  })
}
// 商品批量下架
export function productinfoBatchUnmount(data) {
  return request({
    url: '/store/productinfo/batchUnmount',
    method: 'post',
    data: data
  })
}

// 上架 下架
export function productinfoBatchUnmountSingle(data) {
  return request({
    url: '/store/productinfo/release/unmount',
    method: 'post',
    data: data
  })
}

// 虚拟销量
export function setFictiSales(data) {
  return request({
    url: '/store/productinfo/setFictiSales',
    method: 'post',
    data: data
  })
}